<div class="admin">
<div class="tab panel dux-box admin-panel">
    <div class="panel-head">
        <strong>
            <empty name="goods.goods_id">
                所有商品的评论管理
            <else />
                <span style="color: red">{$goods['goods_name']}</span>商品的评论管理
            </empty>
        </strong>
    </div>

    <div class="fixed-empty">
        <empty name="goods.goods_id">
            <a href="{:U('addComment')}" class="button button-small border-green" style="margin-left: 20px;margin-top: 20px;">新增商品评论</a>
        <else />
            <a href="{:U('addComment',array('goods_id'=>$goods['goods_id']))}" class="button button-small border-green" style="margin-left: 20px;margin-top: 20px;">为{$goods['goods_name']} 商品新增评论</a>
        </empty>
    </div>

    <form method="post" action="" name="formSearch" id="formSearch">
        <div class="table-tools clearfix ">
            <div class="float-left">
                <div class="form-inline">
                    <div class="form-group">
                        <div class="field"><label>用户名：</label><input class="input input_small" type="text" name="user_name" value="" /></div>&nbsp;&nbsp;&nbsp;&nbsp;
                        <div class="field"><label>时间：</label>
                            <input class="input input_big hasDatepicker" type="text" value="" id="query_start_time" name="query_start_time" readonly="readonly">至
                            <input class="input input_big hasDatepicker" type="text" value="" id="query_end_time" name="query_end_time" readonly="readonly">
                        </div>
                        <input class="button bg-blue" type="submit" value="查询"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <div style="text-align:right;"><a class="button" target="_blank" href="index.php?act=order&amp;op=index&amp;op=export_step1"><span>导出Excel</span></a></div>
    <table class="table tb-type2 nobdb">
        <thead>
        <tr class="thead">
            <th class="align-center">编号</th>
            <th class="align-center">会员</th>
            <th class="align-center" width="17%">商品名</th>
            <th class="align-center" style="width:30%">评论</th>
            <th class="align-center">卖家回复</th>
            <th class="align-center">是否显示</th>
            <th class="align-center">评价时间</th>
            <th class="align-center">用户</th>
            <th class="align-center">操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach item="v" name="list">
            <tr class="hover" style="background: rgb(255, 255, 255);">
                <td class="align-center">{$v['id']}</td>
                <td class="align-center">
                    <if condition="$v['user_id']">
                        <a href="{:U('User/details',array('user_id'=>$v['user_id']))}">{$v['user_name']}</a>
                    <else />
                        {$v['user_name']}
                    </if>
                </td>
                <td class="align-center"><a href="{:HOME_URL}/Goods/{$v['goods_id']}.html" target="_blank">{$v['goods_name']|sub_str=###,0,12}</a></td>
                <td class="nowrap align-center">{$v['comment']}</td>
                <td class="nowrap align-center">{$v['reply']|sub_str=###,0,10}</td>
                <td class="nowrap align-center" onclick="is_show($(this),{$v['id']})">
                    {$v['is_show']?'<span style="color: #00aa00;font-weight:bold;cursor:pointer;" is_show="1">√</span>':'<span style="color: red;font-weight:bold;cursor:pointer;" is_show="0">×</span>'}
                </td>
                <td class="nowrap align-center">{:date('y-m-d H:i:s',$v['add_time'])}</td>
                <td class="nowrap align-center">
                    <if condition="$v['user_id']">
                        是
                    </if>
                </td>
                <td class="w144 align-center">
                <a class="button bg-green button-little" href="{:U('replyComment',array('id'=>$v['id']))}"><i class="icon-comment"></i>回复</a>
                <a class="button bg-red button-little" href="{:U('deleteComment',array('id'=>$v['id']))}"><i class="icon-minus-circle"></i>删除</a>
                    <!-- 删除 -->
                </td>
            </tr>
        </foreach>
        </tbody>
        <tfoot>
        <tr class="tfoot">
            <td colspan="15"><div class="pages clearfix">{$pages}</div></td>
        </tr>
        </tfoot>
    </table>
</div>
</div>
<script type="text/javascript">
    $('#myform').layer({
        actionUrl: "batchAction",
        deleteUrl: "del",
    });
    $('#query_start_time').duxTime({
        timepicker:false,

    });
    $('#query_end_time').duxTime({
        timepicker:false,

    });
    function is_show(t,id) {
        if(Number(t.find('span').attr('is_show'))){
            data = {is_show:0};
            txt = '隐藏该评价？';
        }else{
            data = {is_show:1};
            txt = '公开该评价？';
        }
        layer.confirm(txt, {
            btn: ['YES','NO'] //按钮
        }, function(){
            data.id = id;
            var p = Aajax('{:U('is_show')}',data);
            if(p.a){
                t.empty();
                if(data.is_show){
                    html = '<span style="color: #00aa00;font-weight:bold;cursor:pointer;"  is_show="1">√</span>';
                }else{
                    html = '<span style="color: red;font-weight:bold;cursor:pointer;"  is_show="0">×</span>';
                }
                t.html(html);
                layer.msg('修改成功');
            }else{
                layer.msg('失败请稍后重试');
            }
        })

    }
</script>

